.class public Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;
.super Ljava/lang/Object;
.source "ActivtyLauncher.java"


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private final mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

.field private final mContext:Landroid/content/Context;

.field private mNetworkName:Ljava/lang/String;

.field private mTag:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 36
    const-class v0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->TAG:Ljava/lang/String;

    .line 41
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;Landroid/content/Context;)V
    .locals 1
    .parameter "source"
    .parameter "currentContext"

    .prologue
    .line 69
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 70
    iput-object p1, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    .line 71
    iput-object p2, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mContext:Landroid/content/Context;

    .line 72
    sget-object v0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->TAG:Ljava/lang/String;

    iput-object v0, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mTag:Ljava/lang/String;

    .line 73
    return-void
.end method


# virtual methods
.method public getNetworkName()Ljava/lang/String;
    .locals 1

    .prologue
    .line 123
    iget-object v0, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mNetworkName:Ljava/lang/String;

    return-object v0
.end method

.method public launchActivity()V
    .locals 8

    .prologue
    const/4 v7, 0x0

    .line 79
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mContext:Landroid/content/Context;

    if-eqz v3, :cond_2

    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    if-eqz v3, :cond_2

    .line 80
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    invoke-interface {v3}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->isAllowedToLaunch()Z

    move-result v3

    if-nez v3, :cond_0

    .line 81
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    const-string v4, "Launch isn`t allowed. Basically this means that interstitial of the same type is showing now."

    invoke-interface {v3, v4}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->onFailToLaunch(Ljava/lang/String;)V

    .line 104
    :goto_0
    return-void

    .line 85
    :cond_0
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    invoke-interface {v3}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->getIntent()Landroid/content/Intent;

    move-result-object v2

    .line 86
    .local v2, intent:Landroid/content/Intent;
    if-eqz v2, :cond_1

    .line 87
    const-string v3, "networkName"

    iget-object v4, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mNetworkName:Ljava/lang/String;

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 90
    :cond_1
    :try_start_0
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    invoke-interface {v3}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->beforeLaunch()V

    .line 91
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mContext:Landroid/content/Context;

    invoke-virtual {v3, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 92
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    invoke-interface {v3}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->onSuccesToLaunch()V
    :try_end_0
    .catch Landroid/content/ActivityNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 94
    :catch_0
    move-exception v1

    .line 95
    .local v1, e:Landroid/content/ActivityNotFoundException;
    invoke-virtual {v2}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v3

    invoke-virtual {v3}, Landroid/content/ComponentName;->getClassName()Ljava/lang/String;

    move-result-object v0

    .line 96
    .local v0, className:Ljava/lang/String;
    sget-object v3, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v4, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mTag:Ljava/lang/String;

    const-string v5, "Cannot load Burstly interstitial. Did you add {0} activity to your manifest file?"

    const/4 v6, 0x1

    new-array v6, v6, [Ljava/lang/Object;

    aput-object v0, v6, v7

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 98
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    invoke-interface {v3, v0}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->onActivityNotFound(Ljava/lang/String;)V

    goto :goto_0

    .line 101
    .end local v0           #className:Ljava/lang/String;
    .end local v1           #e:Landroid/content/ActivityNotFoundException;
    .end local v2           #intent:Landroid/content/Intent;
    :cond_2
    sget-object v3, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v4, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mTag:Ljava/lang/String;

    const-string v5, "Context or Condition is null!"

    new-array v6, v7, [Ljava/lang/Object;

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 102
    iget-object v3, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mCondition:Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;

    const-string v4, "Context or Condition is null!"

    invoke-interface {v3, v4}, Lcom/burstly/lib/component/activitylauncher/IActivityLauncherSource;->onFailToLaunch(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public setNetworkName(Ljava/lang/String;)Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;
    .locals 0
    .parameter "networkName"

    .prologue
    .line 133
    iput-object p1, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mNetworkName:Ljava/lang/String;

    .line 134
    return-object p0
.end method

.method public setTag(Ljava/lang/String;)Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;
    .locals 0
    .parameter "tag"

    .prologue
    .line 113
    iput-object p1, p0, Lcom/burstly/lib/component/activitylauncher/ActivtyLauncher;->mTag:Ljava/lang/String;

    .line 114
    return-object p0
.end method
